/*
* @Author: majingyu
* @Date:   2017-05-25 18:56:58
* @Last Modified by:   jingyu.ma
* @Last Modified time: 2017-07-16 14:06:31
*/

import React from 'react';
import { connect } from 'react-redux';
import { getUserMessage } from 'action/user.js';

import 'css/mine.less';

class Mine extends React.Component{
    constructor(props){
        super(props);
        
        this.props.dispatch(getUserMessage());
       
    }
    goPage(page){
        window.location.href = page;
    }
    render(){
        let userName = this.props.user.user?this.props.user.user.name:'';
        return(
            <div className="content">
                <div className="usermess" onClick={()=>this.goPage('#/myDetail')}>
                    <div className="img-info">
                        <img src="/image/header.jpg" alt="用户头像" />
                    </div>
                    <span className="name">{userName}</span>
                    <span className="img-tip">></span>
                </div>
                <div className="body-info">
                    <p className="my-order" onClick={()=>this.goPage('#/myOrders')}>
                        <span className="text" >我的订单</span>
                        <span className="img-tip">></span>
                    </p>
                    <p className="my-order" onClick={()=>this.goPage('#/myPublish')}>
                        <span className="text" >我的发布</span>
                        <span className="img-tip">></span>
                    </p>
                    <p className="my-order" onClick={()=>this.goPage('#/evaluate')}>
                        <span className="text">意见反馈</span>
                        <span className="img-tip">></span>
                    </p>
                </div>
            </div>
        );
    }

}
const MineData = (state) => {
    return {
        user:state.user
    }
}
let visibileMine = connect(MineData)(Mine);
export default visibileMine;